//
//  emoticonModel.swift
//  01-keyBoard
//
//  Created by Leon on 15/10/23.
//  Copyright © 2015年 Leon. All rights reserved.
//

import UIKit
// MARK: - 图像模型
class EmoticonModel: NSObject {

    /// 表情使用的次数
    var times = 0
    /// 表情文字
    var chs: String?
    /// 表情图片文件名
    var png: String?
    /// 表情图片路径
    var imagePath: String {
        if png == nil {
            return ""
        }
        return NSBundle.mainBundle().bundlePath + "/Emoticons.bundle/" + png!
    }
    /// 表情字符 emoji编码
    var code: String? {
        didSet{
            code = code?.emoji
        }
    }
    /// 是否删除按钮标记
    var isRemoved = false
    /// 是否空白按钮标记
    var isEmpty = false
    
    // MARK: - 构造函数
    init(isEmpty: Bool) {
        self.isEmpty = isEmpty
    }
    
    init(isRemoved: Bool) {
        self.isRemoved = isRemoved
    }

    
    init(dict:[String: AnyObject]) {
        super.init()
        setValuesForKeysWithDictionary(dict)
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {}
    
    override var description: String {
        
        let keys = ["chs", "png", "code", "isEmpty"]
        return dictionaryWithValuesForKeys(keys).description
    }
}
